<%@ page contentType="text/html;charset=UTF-8"%>
<%@ page trimDirectiveWhitespaces="true" %> 
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions"%>
<%@ taglib prefix="shiro" uri="http://shiro.apache.org/tags"%>

<c:set var="ctx" value="${pageContext.request.contextPath}" />

<div id="main-content">
	<div class="col-lg-12">
		<p class="legend">修改服务信息</p>
		<form id="update-form" class="form-horizontal">
			<div class="form-group">
			<input type="hidden" name="id" class="form-control required" value="${project.id }"/>
			<input type="hidden" name="uid" class="form-control required" value="${project.institution.user.id }"/>
			<div class="form-group">
				<label for="name" class=""><b>服务名：</b></label>
				<input type="text" id="name" name="name" class="form-control required" readonly="readonly" value="${project.name }"/>
			</div>
				<label for="lastName" class=""><b>服务状态：</b></label>
				<select name="status" id="status">
					<option value="1" <c:if test="${project.status == '1' }">selected</c:if>>预审</option>

					<option value="5" <c:if test="${project.status == '5' }">selected</c:if>>进行中</option>
					<option value="6" <c:if test="${project.status == '6' }">selected</c:if>>关闭</option>
				</select>
<!-- 		
				<label for="" class=""><b>开放平台分类：</b></label>
				<input type="hidden" name="opencategory" id="${project.projectOpen.id }"/>
				<select name="projectOpen" id="projectOpen">					
				</select>
 -->					
				<label for="" class=""><b>服务收益分类：</b></label>
				<input type="hidden" name="benefitcategory" id="${project.projectBenefit.id }"/>
				<select name="projectBenefit" id="projectBenefit">					
				</select>
			</div>
			<div class="form-group"  id="project-tags">
				<label for="lastName" id="tags" style="display:none" class=""><b>服务标签：</b></label>
				<span id="hot" style="display:none">
					<label class="checkbox">
						<input name="tags.hot" type="checkbox" id="checkbox_1" value="hot" <c:if test="${fn:contains(project.tags,'hot,')}">checked</c:if>>首页滚动服务
					</label>
				</span> 
 				<span id="needatt" style="display:none">
 					<label class="checkbox">
 						<input name="tags.needatt" type="checkbox" id="checkbox_2" value="needatt" <c:if test="${fn:contains(project.tags,'needatt,')}">checked</c:if>>需要关注的 
 					</label>
 				</span>
				<%-- <span id="needrec" style="display:none"><label class="checkbox"><input name="tags.needrec" type="checkbox" id="checkbox_3" value="needrec" <c:if test="${fn:contains(project.tags,'needrec,')}">checked</c:if>>需要推荐的</label></span> --%> 
				<span id="needsup" style="display:none">
					<label class="checkbox">
						<input name="tags.needsup" type="checkbox" id="checkbox_4" value="needsup" <c:if test="${fn:contains(project.tags,'needsup,')}">checked</c:if>>需要支持的
					</label>
				</span>
				<span id="gold" style="display:none">
					<label class="checkbox">
						<input name="tags.gold" type="checkbox" id="checkbox_5" value="gold" <c:if test="${fn:contains(project.tags,'gold,')}">checked</c:if>><span id="itemFirstname">金牌服务<span>
					</label>
				</span>
				<span id="small" style="display:none">
					<label class="checkbox">
						<input name="tags.small" type="checkbox" id="checkbox_6" value="small" <c:if test="${fn:contains(project.tags,'small,')}">checked</c:if>><span id="itemFname">小众服务<span>
					</label>
				</span>
			
			</div>
<!-- 			<div class="form-group">
				<label for="name" class=""><b>筹款时间：</b></label>
				<div class="input-append">
					<input type="text" id="validDays" name="validDays" class="form-control required" value="${project.validDays }"style="width:178px;"/><span class="add-on">天</span>
				</div>
		</div>
 -->		
			<div class="form-group" id="contect-select">
				<label><b>联系方式显示内容：</b></label>
				<input type="radio"  value="1" name="contect" style="margin: 0 5px 3px;" checked="checked">显示本站联系方式
				<br>
				<input type="radio"  value="0" name="contect" style="margin: 0 5px 3px;">显示个人服务商联系方式
			</div>
 			<div style="width:40%;margin-top:10px;">
				<span><b>服务：</b></span><span class="pull-right"><button class="btn-link" data-toggle="modal" data-target="#upModal">添加</button></span>
				<div id="productsList" style="margin-bottom:5px;"></div>
			</div>
			<div class="form-group">
				<div class=" ">
					<button type="button" class="btn btn-primary add-submit">保存</button>
				</div>
			</div>
		</form>
	</div>



	<div id="upModal" class="modal hide fade" tabindex="-1" role="dialog"
		aria-labelledby="myModalLabel" aria-hidden="true">
		<div class="modal-header" style="background-color:#ffaa00;height:40px;">
			<button type="button" class="close" data-dismiss="modal" aria-hidden="true" style="position: relative;top: 10px;">×</button>
			<h4 id="myModalLabel" style="position:relative;top:10px;width:100px;margin: 0px;">添加服务</h4>
		</div>
		<div class="modal-body ">
			<form id="goodsSetgoodAdit" class="goodsSetgoodAdit" style="padding-bottom:10px;">
				<input name="id" value="" type="hidden">
				<input name="projectId" value="" type="hidden" class="project_id">
				<input type="hidden" name="code" value="2134">
				<table class="table" style="margin-bottom:0">
					<tr>
						<td style="border-top:none;">服务名称</td>
						<td style="border-top:none;"><input type="text" name="name" id="goodsName" class="goods_name required" value="" /></td>
					</tr>
					<tr class="">
						<td>服务图片</td>
						<td>
							<div class="portrait goodsPic">
								<span class="change-img" onclick="document.getElementById('file_upload').click()"> 上传</span> 
								<input id="photoId" type="hidden" value="" name="photoId" class="pho_id"/>
								<div id="file-preview">
									<img src=""></img>
								</div>
								<label for="correctPortrait" class="correctPortrait"> 
								<input data="" id="file_upload"  type="file" name="photoId" class="correctPortrait upload_f"></input>
								</label>
							</div>
						</td>
					</tr>
					<tr>
						<td>服务介绍</td>
						<td><textarea id="goodsText" name="description" class="required goods_notice" style="width:300px;height:90px"></textarea></td>
					</tr>
					<tr>
						<td>收费标准</td>
						<td><input type="text" name="price" class="price required" value="">&nbsp;元</td>
					</tr>
					<!-- <tr>
						<td>服务总量</td>
						<td><input type="text" name="ammount" class="counts required ammount" value="" />个</td>
                    </tr>
                    <tr>
                        <td>服务每人限购</td>
						<td><input type="text" name="caps" class="limit-cou required" value="" />个</td>
					</tr> -->
				</table>
			</form>
		</div>
		<div class="modal-footer">
			<div class="pull-left subtn">
				<button type="button" class="btn btn-primary addto-address" id="add-submit">添加</button>
			</div>
		</div>
	</div>
</div>



<!-- 服务信息模板 -->
<script type="text/html" id="productList-template">

<table class="product-table" style="width:100%;">
					<thead>
						<tr>
							<td>服务名</td>
							<td>价值</td>
							<td>状态</td>
							<td>操作</td>
						</tr>
					</thead>
					<tbody >
						<$for(var i= 0;i<result.length;i++) {$>
						<tr>
							<td id="pdt-name<$=i$>" value="<$=result[i].name$>"><$=result[i].name$></td>
							<td><$=result[i].price$></td>
							<$ if(result[i].permissions == 'no') {$>
							<td style="color:red;">已关闭</td>
							<$} else {$> 
							<td style="color:green;">未关闭</td>
							<$}$>
							<td><button  type="button" class="btn-link"  name="close" data="<$=result[i].id$>" >关闭</button><button  class="btn-link"  name="open" data="<$=result[i].id$>" >开启</button></td>
						</tr>
					<$}$>
					
					</tbody>
</table>

<$ if ( totalPages > 1 ) { $>
	<div class="pagination">
		<$==pagination$>
	</div>
<$ } $>
</script>


<c:if test="${env == 'production' }">
	<script type="text/javascript">
		seajs.use("${ctx}/assets/js-dist/admin/project-edit-page");
	</script>


</c:if>
<c:if test="${env != 'production' }">
	<script type="text/javascript">
		seajs.use("${ctx}/assets/js/admin/project-edit-page");
	</script>
</c:if>